//
//  SocketIOClientConfigurationTest.swift
//  QHSocketIODemo
//
//  Created by chen on 2017/5/14.
//  Copyright © 2017年 chen. All rights reserved.
//

import XCTest

class SocketIOClientConfigurationTest: XCTestCase {
    var config = [] as SocketIOClientConfiguration
    
    override func setUp() {
        super.setUp()
        // Put setup code here. This method is called before the invocation of each test method in the class.
        
        config = [.log(false), .forceNew(true)]
        print("haha==>\(config)")
        print("haha==>\(config[0].description)+\(config[0].getSocketIOOptionValue())")
    }
    
    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }
    
    func testReplaceSameOption() {
        config.insert(.log(true))
        
        XCTAssertEqual(config.count, 2)
        
        switch config[0] {
        case let .log(log):
            XCTAssertTrue(log)
        default:
            XCTFail()
        }
    }
    
    func testIgnoreIfExisting() {
        config.insert(.forceNew(false), replacing: false)
        
        XCTAssertEqual(config.count, 2)
        
        switch config[1] {
        case let .forceNew(new):
            XCTAssertTrue(new)
        default:
            XCTFail()
        }
    }
    
}
